package com.book.domain;

import java.util.HashMap;


public class Cart {

	
    String totalprice;
    public String getTotalprice() {
		return totalprice;
	}
	public void setTotalprice(String totalprice) {
		this.totalprice = totalprice;
	}
	public HashMap<Integer, BookItem> getCartMap() {
		return cartMap;
	}
	public void setCartMap(HashMap<Integer, BookItem> cartMap) {
		this.cartMap = cartMap;
	}
	HashMap<Integer, BookItem> cartMap=new HashMap<Integer, BookItem>();
    public void addBookItem(BookItem bookItem){
      if(	cartMap.get(bookItem.getId())!=null){
    BookItem	bookItem1=  cartMap.get(bookItem.getId());
    bookItem1.setBooknumber(bookItem1.getBooknumber()+1);
    bookItem1.setBookstotalprice(bookItem1.getBookstotalprice()+bookItem1.getBookprice());
    this.totalprice+=bookItem1.bookprice;
      }else {
		cartMap.put(bookItem.getId(), bookItem);
	}
    }
    public void minusBookItem(BookItem bookItem){
    	
    }
}
